package com.literature.threeGroup.controller;

import com.literature.threeGroup.pojo.Menu;
import com.literature.threeGroup.pojo.Organ;
import com.literature.threeGroup.pojo.Param;
import com.literature.threeGroup.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.net.UnknownHostException;
import java.util.List;

/**
 * @author VULCAN
 * @create 2020-01-07 14:31
 * @desc
 **/
@RestController
@CrossOrigin
public class MenuController {

    @Autowired
    private MenuService userService;
    /**
      * @name  菜单
     * @Author VULCAN
     * @Date 2020/1/24 11:34
     */
    @RequestMapping(value = "treeMenu/{id}",method = RequestMethod.GET)
    public List<Menu> treeMenu(@PathVariable("id") String id){
        List<Menu> findall = userService.treeMenu(id);
        return findall;
    }

    /**
      * @name  权限列表
     * @Author VULCAN
     * @Date 2020/1/10 8:53
     */
    @RequestMapping(value = "findmenu",method = RequestMethod.GET)
    public List<Menu> findmenu(){
        List<Menu> findall = userService.findmenu();
        return findall;
    }
    /**
      * @name  机构tree
     * @Author VULCAN
     * @Date 2020/1/10 8:55
     */
    @RequestMapping(value = "findorgantree",method = RequestMethod.GET)
    public List<Organ> findorgantree(){
        List<Organ> findall = userService.findorgantree();
        return findall;
    }
    /**
      * @name  参数tree
     * @Author VULCAN
     * @Date 2020/1/10 8:55
     */
    @RequestMapping(value = "findparamtree",method = RequestMethod.GET)
    public List<Param> findparamtree(){
        List<Param> findall = userService.findparamtree();
        return findall;
    }

    /**
     * @name  机构列表 + 模糊
     * @Author VULCAN
     * @Date 2020/1/22 13:16
     */
    @RequestMapping(value = "findorgantreelikename",method = RequestMethod.POST)
    public List<Organ> findorgantreelikename(@RequestBody Organ organ){
        List<Organ> findall = userService.findorgantreelikename(organ);
        return findall;
    }
    /**
     * @name  参数列表 +模糊
     * @Author VULCAN
     * @Date 2020/1/22 13:19
     */
    @RequestMapping(value = "findparamtreelikename",method = RequestMethod.POST)
    public List<Param> findparamtreelikename(@RequestBody Param param){
        List<Param> findall = userService.findparamtreelikename(param);
        return findall;
    }
    /**
     * @name  机构删除
     * @Author VULCAN
     * @Date 2020/1/23 12:45
     */
    @RequestMapping(value = "organdel/{id}",method = RequestMethod.DELETE)
    public void organdel(@PathVariable("id") String id) throws UnknownHostException {
        userService.organdel(id);
    }
    /**
     * @name  机构添加
     * @Author VULCAN
     * @Date 2020/1/23 12:45
     */
    @RequestMapping(value = "organadd",method = RequestMethod.POST)
    public void organadd(@RequestBody Organ organ) throws UnknownHostException {
        userService.organadd(organ);
    }
    /**
     * @name  机构修改
     * @Author VULCAN
     * @Date 2020/1/23 12:45
     */
    @RequestMapping(value = "organupdate",method = RequestMethod.POST)
    public void organupdate(@RequestBody Organ organ) throws UnknownHostException {
        userService.organupdate(organ);
    }
    /**
     * @name  参数删除
     * @Author VULCAN
     * @Date 2020/1/23 12:45
     */
    @RequestMapping(value = "paramdel/{id}",method = RequestMethod.DELETE)
    public void paramdel(@PathVariable("id") String id) throws UnknownHostException {
        userService.paramdel(id);
    }
    /**
     * @name  参数添加
     * @Author VULCAN
     * @Date 2020/1/23 12:45
     */
    @RequestMapping(value = "paramadd",method = RequestMethod.POST)
    public void paramadd(@RequestBody Param param) throws UnknownHostException {
        userService.paramadd(param);
    }
    /**
     * @name  参数修改
     * @Author VULCAN
     * @Date 2020/1/23 12:45
     */
    @RequestMapping(value = "paramupdate",method = RequestMethod.POST)
    public void paramupdate(@RequestBody Param param) throws UnknownHostException {
        userService.paramupdate(param);
    }
    /**
     * @name  organcount
     * @Author VULCAN
     * @Date 2020/1/28 14:25
     */
    @RequestMapping(value = "organcount",method = RequestMethod.GET)
    public List organcount(){
        return userService.organcount();
    }
    /**
     * @name  usercount
     * @Author VULCAN
     * @Date 2020/1/28 14:25
     */
    @RequestMapping(value = "paramcount",method = RequestMethod.GET)
    public List paramcount(){
        return userService.paramcount();
    }
    /**
     * @name  学科
     * @Author VULCAN
     * @Date 2020/2/1 18:18
     */
    @RequestMapping(value = "findparamsubject",method = RequestMethod.GET)
    public List<Param> findparamsubject() {
        return userService.findparamsubject();
    }
    /**
     * @name  国家
     * @Author VULCAN
     * @Date 2020/2/1 18:18
     */
    @RequestMapping(value = "findparamcountry",method = RequestMethod.GET)
    public List<Param> findparamcountry() {
        return userService.findparamcountry();
    }
    /**
     * @name  文献
     * @Author VULCAN
     * @Date 2020/2/1 18:18
     */
    @RequestMapping(value = "findparamliterature",method = RequestMethod.GET)
    public List<Param> findparamliterature() {
        return userService.findparamliterature();
    }
    /**
     * @name  载体
     * @Author VULCAN
     * @Date 2020/2/1 18:18
     */
    @RequestMapping(value = "findparamcmorphology",method = RequestMethod.GET)
    public List<Param> findparamcmorphology() {
        return userService.findparamcmorphology();
    }
    /**
     * @name  语种
     * @Author VULCAN
     * @Date 2020/2/1 18:18
     */
    @RequestMapping(value = "findparamlanguage",method = RequestMethod.GET)
    public List<Param> findparamlanguage() {
        return userService.findparamlanguage();
    }
    /**
     * @name  学科级别下拉
     * @Author VULCAN
     * @Date 2020/2/8 13:00
     */
    @RequestMapping(value = "findparamsubjectXl",method = RequestMethod.GET)
    public List<Param> findparamsubjectXl() {
        return userService.findparamsubjectXl();
    }
    /**
     * @name  语种级别下拉
     * @Author VULCAN
     * @Date 2020/2/8 13:00
     */
    @RequestMapping(value = "findparamlanguageXl",method = RequestMethod.GET)
    public List<Param> findparamlanguageXl() {
        return userService.findparamlanguageXl();
    }
}
